//医保结算
<template>
  <el-row class="hospitalizedCharge-content">
    <div
      style="height: 75vh;
    overflow: auto;"
    >
      <el-col
        :span="24"
        class="pddTop hospitalizedCharge-right"
        style="padding: 0 10px; padding-top: 10px;overflow:hidding;min-height:75vh"
      >


        <ViewTitle text="结算信息111" id="ruyuan"/>
        <el-col :span="24" class="pddTop10" @click='hospitalization4'>
          <el-form
            :inline="false"
            class="form-demo"
            label-width="auto"
            v-model="redata"
          >
            <el-col :span="6">
              <el-form-item label="就诊卡类型:">
                <el-radio-group v-model="redata.cert_type">
                  <el-radio label="01">电子凭证</el-radio>
                  <el-radio label="02">身份证</el-radio>
                  <el-radio label="03">社保卡</el-radio>
                </el-radio-group>

              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="就诊凭证号:">
                <el-input v-model="redata.cert_no"></el-input>

              </el-form-item>
              <el-form-item label="卡识别码:">
                <el-input v-model="redata.card_sn"></el-input>

              </el-form-item>
            </el-col>
            <el-col :span="4">
              <el-form-item label="异地:">
                <el-checkbox v-model="redata.is_yd"></el-checkbox>

              </el-form-item>

            </el-col>
            <el-col :span="3" v-if="redata.is_yd">

              <el-form-item label="参保地:">
                <el-input v-model="redata.insuplc_admdvs"></el-input>

              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="">
                <el-button type="success" @click="duka">读卡</el-button>
                <el-button type="success" @click="duquinfo">读取个人信息</el-button>
                <el-button type="success" @click="daiyuinfo">人员待遇检查</el-button>

              </el-form-item>
            </el-col>
          </el-form>
        </el-col>


        <ViewTitle text="基本信息" id="ruyuan"/>
        <el-col :span="24">
          <el-form
            :inline="false"
            class="form-demo"
            label-width="auto"
            v-model="baseinfo"
          >
            <el-col :span="6">
              <el-form-item label="人员编号:">
                <el-input
                  size="small" placeholder="人员编号"
                  v-model="baseinfo.psn_no"
                  :disabled='ifxiu'
                >
                </el-input>
              </el-form-item>
              <el-form-item label="性别:">
                <el-input
                  size="small" placeholder="性别"
                  v-model="baseinfo.gend"
                  :disabled='ifxiu'
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="证件类型:">
                <el-input
                  size="small" placeholder="证件类型"
                  v-model="baseinfo.psn_cert_type"
                  :disabled='ifxiu'
                >
                </el-input>
              </el-form-item>
              <el-form-item label="民族:">
                <el-input
                  size="small" placeholder="民族"
                  v-model="baseinfo.naty"
                  :disabled='ifxiu'
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="证件号码:">
                <el-input
                  size="small" placeholder="证件号码"
                  v-model="baseinfo.certno"
                  :disabled='ifxiu'
                >
                </el-input>
              </el-form-item>
              <el-form-item label="出生日期:">
                <el-input
                  size="small" placeholder="出生日期"
                  v-model="baseinfo.brdy"
                  :disabled='ifxiu'
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="姓名:">
                <el-input
                  size="small" placeholder="姓名"
                  v-model="baseinfo.psn_name"
                  :disabled='ifxiu'
                >
                </el-input>
              </el-form-item>
              <el-form-item label="年龄:">
                <el-input
                  size="small" placeholder="年龄"
                  v-model="baseinfo.age"
                  :disabled='ifxiu'
                >
                </el-input>
              </el-form-item>
            </el-col>
          </el-form>
        </el-col>

        <el-col :span="24">
          <ViewTitle text="参保信息" id="ruyuan"/>
          <el-table
            ref="singleTable"
            :data="insuinfo"
            highlight-current-row
            style="width: 100%"
            @row-click="xuaninsutype"
            @selection-change="handleSelectionChange"
            @select-all="selectAll"
          >
            <el-table-column
              type="selection"
              width="55">
            </el-table-column>
            <el-table-column property="insutypename" label="险种类型">
            </el-table-column>
            <el-table-column property="psn_typename" label="人员类型">
            </el-table-column>
            <el-table-column property="cvlserv_flag" label="公务员标志">
            </el-table-column>
            <el-table-column property="emp_name" label="单位名称">
            </el-table-column>
            <el-table-column property="paus_insu_date" label="参保日期">
            </el-table-column>
            <!-- <el-table-column property="" label="暂停日期">
            </el-table-column> -->
            <el-table-column property="balc" label="余额">
            </el-table-column>
            <el-table-column property="psn_insu_stas" label="参保状态">
            </el-table-column>
          </el-table>
        </el-col>
        <el-form
          :inline="false"
          class="form-demo"

          v-model="menfrom"
        >
          <el-col :span="24" style="magin-top:20px">

            <el-col :span="8">
              <el-form-item label="医疗类别" label-width="80px">
                <el-select size="small" v-model="menfrom2.med_type" placeholder="医疗类别">
                  <el-option
                    v-for="(item, index) in yiliaolist"
                    :key="index"
                    :label="item.name"
                    :value="item.id"
                  >{{ item.name }}
                  </el-option
                  >
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="病种:" label-width="80px">
                <el-popover placement="bottom-end" v-loading="threeSelectLoading" width="500px" trigger="focus">
                  <el-input
                    placeholder="选择病种"
                    slot="reference"
                    v-model="renyuandata.dise_name"
                    @input="daiyuinfo()"
                  >
                    <i slot="suffix" class="el-input__icon el-icon-search"></i>
                  </el-input>

                  <el-table
                    v-loading="threeSelectLoading"
                    height="300"
                    @row-click="xuanzeDatathree"
                    :data="selectData1"
                    style="width: 100%"
                  >
                    <el-table-column label="编号" prop="sp_code" width="150">
                    </el-table-column>


                    <el-table-column label="病种名称" prop="sp_name">
                    </el-table-column>

                  </el-table>
                  <el-pagination
                    :current-page="selectParams.page"
                    :page-size="selectParams.limit"
                    @current-change="handlePagination"
                    :total="selectParams.pageCount"
                    layout="prev, pager, next"
                  >
                  </el-pagination>
                </el-popover>


              </el-form-item>
            </el-col>
            <!-- <el-col :span="6">
            <el-form-item label=" " label-width="80px">
               <el-checkbox-group v-model="menfrom.acct_used_flag">
<el-checkbox label="个人账户使用规则"  name="type"></el-checkbox>

</el-checkbox-group>
            </el-form-item>
          </el-col> -->

          </el-col>


          <el-col :span="24">

            <ViewTitle text="预结算信息" id="ruyuan"/>
            <el-col :span="3">
              <el-form-item label="先行自付金额:">
                <el-input size="small" placeholder="先行自付金额"
                          :disabled='ifxiu' v-model="menfrom.preselfpay_amt">
                </el-input>
              </el-form-item>
              <el-form-item label="基金支付总额:">
                <el-input size="small" placeholder="基金支付总额"
                          :disabled='ifxiu' v-model="menfrom2.fund_pay_sumamt">
                </el-input>
              </el-form-item>

            </el-col>
            <el-col :span="3">
              <el-form-item label="超限价自费费用:">
                <el-input size="small" placeholder="超限价自费费用"
                          :disabled='ifxiu' v-model="menfrom.overlmt_selfpay">
                </el-input>
              </el-form-item>
              <el-form-item label="基本医疗保险:">
                <el-input size="small" placeholder="基本医疗保险"
                          :disabled='ifxiu' v-model="menfrom2.hifp_pay">
                </el-input>
              </el-form-item>
              <el-form-item label="职工大额医疗补助:">
                <el-input size="small" placeholder="职工大额医疗补助"
                          :disabled='ifxiu' v-model="menfrom2.hifob_pay">
                </el-input>
              </el-form-item>

            </el-col>
            <el-col :span="3">
              <el-form-item label="全自费金额:">
                <el-input size="small" placeholder="全自费金额"
                          :disabled='ifxiu' v-model="menfrom.fulamt_ownpay_amt">
                </el-input>
              </el-form-item>
              <el-form-item label="公务员医疗补助:">
                <el-input size="small" placeholder="公务员医疗补助"
                          :disabled='ifxiu' v-model="menfrom2.cvlserv_pay">
                </el-input>
              </el-form-item>
              <el-form-item label="医疗救助:">
                <el-input size="small" placeholder="医疗救助"
                          :disabled='ifxiu' v-model="menfrom2.maf_pay">
                </el-input>
              </el-form-item>

            </el-col>
            <el-col :span="4">
              <el-form-item label="符合政策范围金额:">
                <el-input size="small" placeholder="符合政策范围金额"
                          :disabled='ifxiu' v-model="menfrom.inscp_scp_amt ">
                </el-input>
              </el-form-item>
              <el-form-item label="企业补助医疗保险:">
                <el-input size="small" placeholder="企业补助医疗保险"
                          :disabled='ifxiu' v-model="menfrom2.hifes_pay">
                </el-input>
              </el-form-item>
              <el-form-item label="其他支出:">
                <el-input size="small" placeholder="其他支出"
                          :disabled='ifxiu' v-model="menfrom2.oth_pay">
                </el-input>
              </el-form-item>

            </el-col>
            <el-col :span="4">
              <el-form-item label="实际支付起付线:">
                <el-input size="small" placeholder="实际支付起付线"
                          :disabled='ifxiu' v-model="menfrom.refl_rea">
                </el-input>
              </el-form-item>
              <el-form-item label="居民大病保险:">
                <el-input size="small" placeholder="居民大病保险"
                          :disabled='ifxiu' v-model="menfrom2.hifmi_pay">
                </el-input>
              </el-form-item>

            </el-col>
            <el-col :span="24">

              <el-col :span="3">
                <el-form-item label="个人负担总额:">
                  <el-input size="small" placeholder="个人负担总额"
                            :disabled='ifxiu' v-model="menfrom2.psn_part_amta">
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item label="个人账户支出:">
                  <el-input size="small" placeholder="个人账户支出"
                            :disabled='ifxiu' v-model="menfrom2.acct_pay">
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="3">
                <el-form-item label="个人现金支出:">
                  <el-input size="small" placeholder="个人现金支出"
                            :disabled='ifxiu' v-model="menfrom2.psn_cash_pay">
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="个人账户共济支付金额:">
                  <el-input size="small" placeholder="个人账户共济支付金额"
                            :disabled='ifxiu' v-model="menfrom2.acct_mulaid_pay">
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="个人账户余额:">
                  <el-input size="small" placeholder="个人账户余额"
                            :disabled='ifxiu' v-model="menfrom2.balc">
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="商保支付金额:">
                  <el-input size="small" placeholder="商保支付金额"
                            :disabled='ifxiu' v-model="menfrom2.commercial_reimamt">
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="4">
                <el-form-item label="商保支付标志:">
                  <el-input size="small" placeholder="商保支付标志"
                            :disabled='ifxiu' v-model="menfrom2.commercial_renflag">
                  </el-input>
                </el-form-item>
              </el-col>
            </el-col>
            <el-col :span="24" style="margin-top:40px">


              <el-col :span="6">
                <el-form-item label="医疗总金额:" label-width="100px">
                  <el-input size="small" placeholder="医疗总金额"
                            v-model="menfrom.medfee_sumamt">
                  </el-input>
                </el-form-item>

              </el-col>
              <el-col :span="6">
                <el-form-item label="个人账户支出:" label-width="100px">
                  <el-input size="small" placeholder="个人账户支出"
                            v-model="zhzcmoeny"
                            type="number"
                            @input="jisuangeren"
                  >
                  </el-input>
                </el-form-item>

              </el-col>
              <el-col :span="6">

                <el-form-item label="个人结算方式:" label-width="120px">
                  <el-select size="small" v-model="menfrom.psn_setlway" placeholder="个人结算方式">
                    <el-option
                      v-for="(item, index) in jiesuanlist"
                      :key="index"
                      :label="item.name"
                      :value="item.id"
                    >{{ item.name }}
                    </el-option
                    >
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="6">
                &nbsp;
              </el-col>
              <el-col :span="6">
                <el-form-item>
                  <el-button type="success" size="small" @click="onSubmit">预结算</el-button>
                  <el-button type="success" size="small" @click="onSubmit2">正式结算</el-button>
                </el-form-item>

              </el-col>
            </el-col>

          </el-col>
        </el-form>


      </el-col>

      <el-dialog :close-on-click-modal='false'
                 title="人员待遇检查"
                 :visible.sync="centerDialogVisible2"
                 width="50%"
                 center
                 :modal='false'
      >
        <el-form
          :inline="false"
          class="form-demo"
          label-width="auto"
          v-model="redata"
        >
          <el-col :span="12">
            <el-form-item label="险种类型:">

              <el-select
                v-model="renyuandata.insutype"
                placeholder="险种类型"
              >
                <el-option
                  v-for="(item, index) in insutypelist"
                  :key="index"
                  :label="item.name"
                  :value="item.id"
                >{{ item.name }}
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="入院时间:">

              <el-date-picker
                v-model="renyuandata.begntime"

                type="date"
                placeholder="选择日期"
                format="yyyy 年 MM 月 dd 日"
                value-format="yyyy-MM-dd"
              >
              </el-date-picker>


            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="结束时间:">

              <el-date-picker
                v-model="renyuandata.endtime"

                type="date"
                placeholder="选择日期"
                format="yyyy 年 MM 月 dd 日"
                value-format="yyyy-MM-dd"
              >
              </el-date-picker>


            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="病种:">
              <el-popover placement="bottom-end" v-loading="threeSelectLoading" width="500px" trigger="focus">
                <el-input
                  placeholder="选择病种"
                  slot="reference"
                  v-model="renyuandata.dise_name"
                  @input="daiyuinfo()"
                >
                  <i slot="suffix" class="el-input__icon el-icon-search"></i>
                </el-input>

                <el-table
                  v-loading="threeSelectLoading"
                  height="300"
                  @row-click="xuanzeDatathree"
                  :data="selectData1"
                  style="width: 100%"
                  ref="table"
                >
                  <el-table-column label="编号" prop="sp_code" width="150">
                  </el-table-column>


                  <el-table-column label="病种名称" prop="sp_name">
                  </el-table-column>

                </el-table>
                <el-pagination
                  :current-page="selectParams.page"
                  :page-size="selectParams.limit"
                  @current-change="handlePagination"
                  :total="selectParams.pageCount"
                  layout="prev, pager, next"
                >
                </el-pagination>
              </el-popover>


            </el-form-item>
          </el-col>
        </el-form>
        <span slot="footer" class="dialog-footer">

    <el-button type="success" @click="center">确 定</el-button>
  </span>
      </el-dialog>

    </div>


  </el-row>
</template>
<script>
import FromList from "@/forComponents/fromList/fromList";
import TopManu from "@/components/TopMenu";
import ViewTitle from "@/forComponents/viewTitle/index.vue";
import {

  getdictIndex,

} from "@/api/register";
import {
  getInfo, hospSettPreSett, hospSettA, queryPsnPriority,
  readcard_sbkjs,
  getDiseaseSpecieDict
} from "@/api/zhuyanre";
import {mapState} from 'vuex'

let that;
export default {
  props: ['user', 'id'],
  // patientinfo: {
  //   type: Object,
  //   default: 0
  // }
  // },
  data() {
    return {
      centerDialogVisible2: false,
      visiblePatient2: false,
      threeSelectLoading: false,
      selectParams: {

        page: 1,
        limit: 15,
        pageCount: 0,

      },
      selectData1: [],
      redata: {
        cert_no: '',
        cert_type: '02',
        card_sn: '',
        member_id: '',
        is_yd: false,
        insuplc_admdvs: ''
      },
      renyuandata: {
        id_card: '',
        insutype: '01',
        begntime: '',
        endtime: '',
        dise_codg: '',
        dise_name: '',
        insuplc_admdvs: '',
      },
      insuinfo: [],
      baseinfo: {
        certno: '',
        psn_no: '',
        gend: '',
        brdy: '',
        naty: '',
        psn_cert_type: '',
        psn_name: '',
        age: '',
      },
      //提交
      menfrom: {
        psn_no: '',
        mdtrt_cert_type: '',
        mdtrt_cert_no: '',
        medfee_sumamt: '',
        psn_setlway: '',
        mdtrt_id: '',
        acct_used_flag: '',
        insutype: '',
        invono: '',
        dise_codg: '',
        dise_name: '',
        mid_setl_flag: '',
        fulamt_ownpay_amt: '',
        overlmt_selfpay: "",
        preselfpay_amt: '',
        inscp_scp_amt: '',
        dscgTime: '',
        refl_rea: '',
        insuplc_admdvs: '',
        id: ''
      },
      menfrom2: {
        med_type: '',
        balc: '',
        acct_mulaid_pay: '',
        psn_cash_pay: '',
        acct_pay: '',
        psn_part_amta: '',
        fund_pay_sumamt: '',
        oth_pay: '',
        hosp_part_amt: "",
        maf_pay: '',
        hifob_pay: '',
        hifmi_pay: "",
        hifes_pay: "",
        cvlserv_pay: "",
        pool_prop_selfpay: '',
        hifp_pay: '',
        act_pay_dedc: '',
        inscp_scp_amt: '',
        preselfpay_amt: "",
        overlmt_selfpay: '',
        fulamt_ownpay_amt: '',
        medfee_sumamt: '',
        cvlserv_flag: '',
        insutype: '',
        insuplc_admdvs: '',
        dise_codg: '',
        dise_name: '',
        id: '',
        commercial_reimamt:'',
        commercial_renflag:'',

      },
      userztype: [],
      minzulist: [],
      usertype: [],
      insutypelist: [],
      jiesuanlist: [],
      yiliaolist: [],
      ifxiu: true,
      insutype: '',
      zhzcmoeny: '',
      Ident_code: ''
    };
  },

  mounted() {
    that = this;

    this.menfrom.id = this.id
    this.redata.cert_no = this.user.id_card
    this.getdiet_list()
    // that.daiyuinfo()
    console.log(this.user, this.id, '000000000000')
    this.duquinfo()
//  console.log(this.menfrom.id)
  },
  watch: {
    user(to) {
      this.menfrom.id = this.id
      this.redata.cert_no = this.user.id_card
      this.duquinfo()

    },

  },
  computed: {
    ...mapState({
      store_patientinfo: (state) => state.yibaoban.patientinfo,

    }),
  },
  methods: {
    duquinfo() {
      var data_t = this.redata
      data_t.member_id = this.user.id
      data_t.is_yd = data_t.is_yd ? 1 : ''

      getInfo(data_t).then(res => {
        that.baseinfo = res.data.baseinfo
        that.baseinfo.gend = res.data.baseinfo.gend == 1 ? '男' :
          res.data.baseinfo.gend == 2 ? "女" : '其他'
        that.baseinfo.naty = this.mapminzu(that.baseinfo.naty)
        that.baseinfo.psn_cert_type = this.mapuserztype(that.baseinfo.psn_cert_type)
        that.insuinfo = res.data.insuinfo
        that.id_card = res.data.baseinfo.id_card
        for (let i = 0; i < that.insuinfo.length; i++) {
          that.insuinfo[i].insutypename = this.mapxian(that.insuinfo[i].insutype)
          that.insuinfo[i].psn_typename = this.mapusertype(that.insuinfo[i].psn_type)
          that.insuinfo[i].cvlserv_flag = that.insuinfo[i].cvlserv_flag == 1 ? '是' : '否'
          that.insuinfo[i].psn_insu_stas = that.insuinfo[i].psn_insu_stas == 0 ? '未参保' : that.insuinfo[i].psn_insu_stas == 1 ? '正常' :
            that.insuinfo[i].psn_insu_stas = that.insuinfo[i].psn_insu_stas == 2 ? '暂停' : '终止'
        }

        this.xuaninsutype(this.insuinfo[0])
        this.menfrom2.med_type = this.store_patientinfo.med_type
        if (this.store_patientinfo.dise_codg_arr) {

          this.xuanzeDatathree({
            sp_code: this.store_patientinfo.dise_codg_arr.dise_codg,
            sp_name: this.store_patientinfo.dise_codg_arr.dise_name
          })
        }


      })
    },
    jisuangeren() {
      var num = parseFloat(that.menfrom2.balc)
      if (that.zhzcmoeny < 0) {
        that.zhzcmoeny = 0
      } else if (that.zhzcmoeny > num) {
        that.zhzcmoeny = num
      }
    },
    duka() {
      var d = {
        type: this.redata.cert_type
      }
      if (this.redata.cert_type == '02') {
        d.id_card = this.redata.cert_no
        d.name = this.user.name
      } else if (this.redata.cert_type == '03') {
        d.xfmx = that.menfrom.medfee_sumamt
        d.baa001 = that.menfrom2.insuplc_admdvs
        d.zhzc = that.zhzcmoeny
        d.tczf = that.menfrom2.hifp_pay
        // d.baa001=that.menfrom2.insuplc_admdvs
      } else if (this.redata.cert_type == '01') {
        d.name = this.user.name
      }
      readcard_sbkjs(d).then(res => {
        if (res.code == 200) {
          this.Ident_code = res.data
        } else {
          this.Ident_code = ''
        }


      })
    },
    daiyuinfo() {
      //  this.centerDialogVisible2=true
      var data_t = {
        keyword: this.renyuandata.dise_name,
        page: this.selectParams.page,
        limit: this.selectParams.limit
      }
      getDiseaseSpecieDict(data_t).then(res => {
        this.selectParams.pageCount = res.data.count
        this.selectData1 = res.data.list
      })
    },
    handlePagination(e) {
      // this.threeSelectLoading = true;
      console.log(this.renyuandata.dise_name)
      var data_t = {
        keyword: this.renyuandata.dise_name,
        page: e,
        limit: this.selectParams.limit
      }
      getDiseaseSpecieDict(data_t).then(res => {
        this.selectParams.pageCount = res.data.count
        this.selectData1 = res.data.list
      })
    },
    xuanzeDatathree(item) {
      console.log(item)
      this.renyuandata.dise_codg = item.sp_code
      this.renyuandata.dise_name = item.sp_name
      this.menfrom.dise_codg = item.sp_code
      this.menfrom.dise_name = item.sp_name
      this.menfrom2.dise_codg = item.sp_code
      this.menfrom2.dise_name = item.sp_name
      this.threeSelectLoading = false
    },
    center() {
      var data_t = this.renyuandata
      data_t.insutype = this.menfrom2.insutype
      data_t.insuplc_admdvs = this.menfrom2.insuplc_admdvs
      queryPsnPriority(data_t).then(res => {
        console.log(res)
      })
    },
    xuaninsutype(item) {
      this.insutype = item.insutype
      this.menfrom2.cvlserv_flag = item.cvlserv_flag == '是' ? '1' : '0'
      this.menfrom2.insuplc_admdvs = item.insuplc_admdvs
      this.menfrom2.insutype = item.insutype
    },
    handleSelectionChange(selection) {
      var obj = selection[0];
      this.insutype = obj.insutype
      this.menfrom2.cvlserv_flag = obj.cvlserv_flag == '是' ? '1' : '0'
      this.menfrom2.insuplc_admdvs = obj.insuplc_admdvs
      this.menfrom2.insutype = obj.insutype
      if (selection.length > 1) {
        this.$refs['singleTable'].clearSelection();
        this.$refs['singleTable'].toggleRowSelection(selection.pop());
      }

    },

    // 禁止全选按钮
    selectAll() {
      this.$refs['table'].clearSelection();
    },
    commercial_renflag_info(type){
      let flag = '';
      switch (type){
        case '0':
          flag = '商保未缴费'
          break;
        case '1':
          flag = '商保正常报销'
          break;
        case '2':
          flag = '个人负担'
          break;
        case '3':
          flag = '商保计算服务调用异常'
          break;
        case '4':
          flag = '商保已支付'
          break;
        case '5':
          flag = '跨年结算商保线上报销'
          break;
        case 'null':
          flag = '不是住院类的结算和限定病种的门慢门特结算'
          break;
      }
      return flag
    },
    onSubmit() {
      var data = this.menfrom
      data.psn_no = this.baseinfo.psn_no
      data.mdtrt_cert_type = this.redata.cert_type
      data.mdtrt_cert_no = this.redata.cert_no
      data.insutype = this.insutype
      data.med_type = this.menfrom2.med_type;
      hospSettPreSett(data).then(res => {
        console.log(res)
        if (res.code == 200) {
          this.$message({
            message: res.message,
            type: "success"
          });
        }
        this.menfrom2 = {
          ...res.data.setlinfo,
          med_type: this.menfrom2.med_type,
          commercial_renflag:this.commercial_renflag_info(res.data.setlinfo.commercial_renflag)
        }
        console.log('menfrom2:',this.menfrom2)
        this.menfrom = {
          id: this.id,

          psn_no: this.menfrom2.psn_no,
          mdtrt_cert_type: this.menfrom2.mdtrt_cert_type,
          mdtrt_cert_no: this.menfrom2.mdtrt_cert_no,
          medfee_sumamt: this.menfrom2.medfee_sumamt,
          psn_setlway: this.menfrom.psn_setlway,
          mdtrt_id: this.menfrom2.mdtrt_id,
          // acct_used_flag:this.menfrom2.acct_used_flag,
          insutype: this.menfrom2.insutype,
          invono: this.menfrom2.invono,
          mid_setl_flag: this.menfrom2.mid_setl_flag,
          fulamt_ownpay_amt: this.menfrom2.fulamt_ownpay_amt,
          overlmt_selfpay: this.menfrom2.overlmt_selfpay,
          preselfpay_amt: this.menfrom2.preselfpay_amt,
          inscp_scp_amt: this.menfrom2.inscp_scp_amt,
          dscgTime: this.menfrom2.dscgTime,
          refl_rea: this.menfrom2.refl_rea,
        }
        console.log("menfrom", this.menfrom)
      })

    },
    onSubmit2() {
      var data = this.menfrom
      data.psn_no = this.baseinfo.psn_no
      data.mdtrt_cert_type = this.redata.cert_type
      data.mdtrt_cert_no = this.redata.cert_no
      data.insutype = this.insutype
      data.id = this.id,
        data.ip_code = that.Ident_code
      data.zhzc = that.zhzcmoeny
      data.med_type = this.menfrom2.med_type;
      this.$emit('jine', this.menfrom2.fund_pay_sumamt)
      hospSettA(data).then(res => {
        if (res.code == 200) {
          this.$message({
            message: "提交成功",
            type: "success"
          });
        }
      })
    },
    getdiet_list() {
      getdictIndex({group_id: "64,37,13,14,63,15"})
        .then(arr => {
          let data = arr.data;

          data.forEach((item, key) => {
            if (item.id == 64) {

              this.userztype = item.items;
            } else if (item.id == 37) {
              this.minzulist = item.items
            } else if (item.id == 14) {
              this.usertype = item.items
            } else if (item.id == 13) {
              this.insutypelist = item.items
            } else if (item.id == 63) {
              this.jiesuanlist = item.items
            } else if (item.id == 15) {
              this.yiliaolist = item.items
            }


          });
        })
        .catch(e => {
        });

    },

    //提交住院信息
    hospitalization4() {
      var data = that.menfrom;

      this.$emit("hospitalization4", data);

    },
    mapusertype(num) {
      var art = "";
      that.usertype.map(function (value, i, array) {
        if (parseInt(array[i].value) == parseInt(num)) {
          art = value.name;
        }
      })
      return art;
    },
    mapxian(num) {
      var art = "";

      that.insutypelist.map(function (value, i, array) {

        if (parseInt(array[i].value) == parseInt(num)) {
          art = value.name;
        }

      })
      return art;
    },
    mapminzu(num) {
      var art = "";
      for (var i in that.minzulist) {
        if (that.minzulist[i].id == num) {
          art = that.minzulist[i].value;
        }
        return art;
      }
    },
    mapuserztype(num) {
      var art = "";
      num = parseInt(num)
      for (var i in that.userztype) {
        if (that.userztype[i].value == num) {
          art = that.userztype[i].name;
        }
        return art;
      }
    },
    closeitalization2() {
      this.$emit("closeitalization2");


    },


  },
  components: {
    FromList,
    TopManu,
    ViewTitle
  },

};
</script>

<style lang='scss' scoped>
@import "./index.scss";

.el-form-item {
  margin-bottom: 0px;
}
</style>
